<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html;charset=utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta content="always" name="referrer">
    <meta name="format-detection" content="telephone=no" />
    <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <title>发布商品</title>
    <link rel="stylesheet" href="/LianniuWeb/css/new/reset.css">
    <link rel="stylesheet" href="/LianniuWeb/css/new/build/css/layui.css"  media="all">
    <link rel="stylesheet" href="/LianniuWeb/css/seller/post_demand.css">
    <link rel="stylesheet" href="/LianniuWeb/css/new//webuploader.css" />
    <link type="text/css" rel="stylesheet" href="/LianniuWeb/css/easydialog.css"/>
    <script type="text/javascript" src="/LianniuWeb/js/widget/easydialog.min.js"></script>
</head>
<body>
<div class="ranking_header">
    <div class="back_btn" onclick="javascript:history.back(-1);"></div>
    <p>发布商品</p>
</div>
<form class="layui-form">
    <!--<div class="">-->
        <!--<div id="fileList" class="uploader-list">-->
            <!--<div id="filePicker"></div>-->
        <!--</div>-->
        <!--<div id="divId"></div>-->
    <!--</div>-->

    <div class="pic_box2" style="margin-bottom:20px">
        <div class="img_box disno" id="fileList">
            <div class="img3 disno">
                <span></span>
                <img src="" id="img1">
            </div>
            <div class="img3 disno">
                <span></span>
                <img src="" id="img2">
            </div>
            <div class="img3 disno">
                <span></span>
                <img src="" id="img3">
            </div>
        </div>
        <div class="file-pick" id="upload">
            <span>添加图片</span>
            <div>
                <p>1.货物的正面照一张</p>
                <p>2.货物侧面照一张</p>
                <p>3.照片务必清晰</p>
            </div>
        </div>
        <div id="filePicker" style="display: none"></div>
    </div>
    <div style="clear:both"></div>

    <div class="padding_both">
        <div class="password_box">
            <span>供应商：</span>
            <input type="text" name="supply" id="supply" placeholder="请输入供应商手机号" maxlength="11">
        </div>
        <div class="select_box">
            <span>一级分类：</span>
            <div class="layui-inline">
                <div class="layui-input-inline">
                    <select name="" id="parentId1" lay-filter="parentId">
                        <option value="">请选择</option>
                    </select>
                    <input type="hidden" id="parentId" name="parentId">
                </div>
            </div>
            <div class="clear"></div>
        </div>
        <div class="select_box">
            <span>二级分类：</span>
            <div class="layui-inline">
                <div class="layui-input-inline">
                    <select name="" id="cateId1" lay-filter="cateId">
                        <option value="">请选择</option>
                    </select>
                    <input type="hidden" id="cateId" name="cateId" value="">
                </div>
            </div>
            <div class="clear"></div>
        </div>
        <div class="select_box">
            <span>商品名称：</span>
            <div class="layui-inline">
                <div class="layui-input-inline">
                    <select name="" id="productName1" lay-filter="productName">
                        <option value="">请选择</option>
                    </select>
                    <input type="hidden" id="productName" name="productName" value="">
                </div>
            </div>
            <div class="clear"></div>
        </div>
        <div class="select_box">
            <span>类别：</span>
            <div class="layui-inline">
                <div class="layui-input-inline">
                    <select name="" id="specId1" lay-filter="specId">
                        <option value="">请选择</option>
                    </select>
                    <input type="hidden" id="specId" name="specId" value="">
                </div>
            </div>
            <div class="clear"></div>
        </div>
        <div class="password_box">
            <span>价格：</span>
            <input type="text" name="price" id="price" placeholder="请输入价格">
        </div>
        <div class="password_box">
            <span>总数量：</span>
            <input type="text" name="overPlusNum" id="overPlusNum" placeholder="请输入库存">
        </div>
        <div class="password_box">
            <span>备注：</span>
            <input type="text" name="remark" id="remark" placeholder="请输入备注" value="" maxlength="50">
        </div>
        <input type="button" value="提交" class="load_btn" id="btn">
    </div>
</form>
<script src="/LianniuWeb/js/commons/commons.js"></script>
<script src="/LianniuWeb/js/jquery/jquery-1.11.3.min.js"></script>
<script src="/LianniuWeb/js/buyer/ranking_slide.js"></script>
<script type="text/javascript" src="/LianniuWeb/js/buyer/flexible.js"></script>
<script src="/LianniuWeb/css/new/build/layui.js" charset="utf-8"></script>
<script src="/LianniuWeb/js/buyer/webuploader.js"></script>
<script src="/LianniuWeb/js/staff/postDemand.js"></script>
<script type="text/javascript">
    $(function(){
        $("#upload").click(function(){
            $("#filePicker").find("input[type=file]").click();
        })
    })
    // 初始化Web Uploader
    var uploader = WebUploader.create({

        // 选完文件后，是否自动上传。
        auto: true,
        // swf文件路径
        swf: '/js/Uploader.swf',

        // 文件接收服务端。
        server: '/LianniuWeb/rest/fileUpload/uploadPic.do?filepath=pubProduct',

        // 选择文件的按钮。可选。
        // 内部根据当前运行是创建，可能是input元素，也可能是flash.
        pick: {id:'#filePicker',multiple:false},
        compress:{
            width: 500,
            height: 550,

            // 图片质量，只有type为`image/jpeg`的时候才有效。
            quality: 40,

            // 是否允许放大，如果想要生成小图的时候不失真，此选项应该设置为false.
            allowMagnify: false,

            // 是否允许裁剪。
            crop: false,

            // 如果发现压缩后文件大小比原来还大，则使用原来图片
            // 此属性可能会影响图片自动纠正功能
            noCompressIfLarger: false,

            // 单位字节，如果图片大小小于此值，不会采用压缩。
            compressSize: 30 * 1024
        },
        // 只允许选择图片文件。
        accept: {
            title: 'Images',
            extensions: 'gif,jpg,jpeg,bmp,png',
            mimeTypes: 'image/*'
        }
    });
    var num = 0;
    uploader.on( 'uploadSuccess', function( file,a,b ) {
        if ($("#img1").attr("src") == ''){
            $("#img1").attr("src", a.data);
            $("#img1").parent().removeClass("disno")
            $("#img1").parent().parent().removeClass("disno")
            if ($("#img1").attr("src") != '' && $("#img2").attr("src") != '' && $("#img3").attr("src") != ''){
                $("#upload").hide()
            }
            return;
        }
        if ($("#img2").attr("src") == ''){
            $("#img2").attr("src", a.data);
            $("#img2").parent().parent().removeClass("disno")
            $("#img2").parent().removeClass("disno")
            if ($("#img1").attr("src") != '' && $("#img2").attr("src") != '' && $("#img3").attr("src") != ''){
                $("#upload").hide()
            }
            return;
        }
        if ($("#img3").attr("src") == ''){
            $("#img3").attr("src", a.data);
            $("#img3").parent().removeClass("disno")
            $("#img3").parent().parent().removeClass("disno")
            if ($("#img1").attr("src") != '' && $("#img2").attr("src") != '' && $("#img3").attr("src") != ''){
                $("#upload").hide()
            }
            return;
        }
    });

    uploader.on( 'uploadError', function( file ) {
        easyAlert("上传出错");
    });
</script>
<script>
    var _hmt = _hmt || [];
    (function() {
        var hm = document.createElement("script");
        hm.src = "https://hm.baidu.com/hm.js?867c800f411683d2a7fa9eb1eabd9736";
        var s = document.getElementsByTagName("script")[0];
        s.parentNode.insertBefore(hm, s);
    })();
</script>
</body>
</html>